package com.work.example.demo5.controller;

import com.work.example.demo5.service.AuthorService;
import com.work.example.demo5.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/author")
@CrossOrigin
public class AuthorController {
    @Autowired
    private AuthorService authorService;
    @GetMapping("/getauthors")
    public R getAuthors() {
        return R.success(authorService.list());
    }
    @GetMapping("/getauthorId")
    public R getAuthorId(String name) {
        return R.success(authorService.getauthorId( name));
    }


}
